#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
#define int long long

int a[maxn + 5];

signed main() {

	for (int i = 1; i <= maxn; i++) {
		for (int j = 2; j * i <= maxn; j++) {
			a[i * j] += i;
		}
	}

	int t;
	cin >> t;
	while (t--) {
		int x, y, ans = 0;
		cin >> x >> y;
		if (x > y)
			swap(x, y);
		for (int i = x; i <= y; i++)
			ans += a[i];
		cout << ans << endl;
	}
	return 0;
}
